package core

import (
	"flag"
	partner "gitee.com/binny_w/gin-partner"
	"github.com/fsnotify/fsnotify"
	"log"
)

var Config *partner.Config

func configInit() {
	Config = partner.NewConfig(func(e fsnotify.Event) {
		log.Fatal("config file changed:", e)
	})
	configFile := ""
	flag.StringVar(&configFile, "c", "", "config file")
	flag.Parse()
	if configFile != "" {
		if err := Config.LoadFromFile(configFile, "yaml"); err != nil {
			panic(err)
		}
	}
}
